<?php
/**
 * @author Thibaut Cromphaut, Gaïtano Boeraeve, Mathias Helin, Dimitry Dierickx
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent 
 */

class Application_Form_AddUser extends Zend_Form
{
    public function init()
    {
        $this->addElement('hidden', 'user_id', array(
            'label'      => '',
            'required'   => true,
            'filters'    => array('StringTrim'),
        ));
        
        $this->addElement('text', 'user_givenname', array(
            'label'      => 'Voornaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', false, array(1, 45)),
            ),
        ));
        
        $this->addElement('text', 'user_familyname', array(
            'label'      => 'Familienaam:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', false, array(1, 45)),
            ),
        ));
        
        $this->addElement(new Application_Form_Element_UserEmail('user_emails', array(
            'label'      => 'Email:',
            'required'   => true,
            //'value'      => "123@123.com*2",
            'filters'    => array('StringTrim'),
            'validators' => array(new Ahs_Validators_UserEmail()),
        )));
        
        $this->addElement(new Application_Form_Element_SecretQuestionSelect('user_secretquestion', array(
            'label'      => 'Geheime vraag:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                new Zend_Validate_Regex('/^[0-9]+$/'),
            ),
        )));
        
        $this->addElement('text', 'user_secretanswer', array(
            'label'      => 'Geheim antwoord:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'Alpha',
                array('StringLength', false, array(1, 45)),
            ),
        ));
        
        $this->addElement('checkbox', 'user_prefnewsletter', array(
            'label'     => 'Stuur me de nieuwsbrief:',
            'value'     => '1',
            'required'  => false,
        ));
        
        $this->addElement(new Application_Form_Element_RoleSelect('user_role'));
        $this->addElement(new Application_Form_Element_ActiveSelect('user_active'));
        $this->addElement(new Application_Form_Element_DeleteSelect('user_deleted'));
        
        $this->addElement('submit', 'edit', array(
            'label'      => 'Save',
        ));

        // CSRF-preventie (Cross-Site Request Forgery)
        /*$this->addElement('hash', 'no_csrf_registration', array(
            'salt' => 'unique',
        ));*/
    }
}